﻿@model IEnumerable<VehicleManagement.Models.Applicant>
@{
    ViewBag.Title = "Index";
}
<link href="../../Content/css/page_yk_index.css" rel="stylesheet" type="text/css" />


@Html.Partial("_PartviewAdminNav")
<div class="content bc">
    <div class="content_link_warn f12">
        你当前的位置：司机管理&gt&gt &nbsp;&nbsp;司机查询&gt&gt &nbsp;&nbsp;所有司机列表
    </div>
    <div class="content_right fr" id="rightcontent">
        <div class="column">
            <h4 class="title f14">
                申请人列表
            </h4>
        </div>
        <div class="maincontent">
            <div class="menuwrap">
                <div class="submenu">
                    @using (Html.BeginForm("Index", "Applicant", FormMethod.Get, new { id = "SearchForm" }))
                    {
                        @Html.Hidden("Page");
                        <div class="box_name dil m010">
                            <span class="label">姓名</span> <span>
                                <input type="text" name="Name" class="txt_name w100" id="name" title="输入要查找的姓名" />
                            </span>
                        </div>
                        <div class="box_sex dil m010">
                            <span class="label">性别</span> <span>
                                <select name="Sex">
                                    <option></option>
                                    <option>男</option>
                                    <option>女</option>
                                </select>
                            </span>
                        </div>
                        <div class="box_state dil m010">
                            <span class="label">职位</span> <span>
                                <select name="Position">
                                    <option></option>
                                    <option>秘书</option>
                                    <option>部门经理</option>
                                    <option>项目总监</option>
                                </select>
                            </span>
                        </div>
                        <div class="box_find dil m010">
                            <input type="submit" class="btn_fc f14" id="find" value="查询" title="查询记录" />
                        </div>
                        <div class="box_create dil m010">
                            <span class="btn_fc f14 h20" title="添加新记录">@Html.ActionLink("添加", "Create")</span>
                        </div>
                    }
                </div>
            </div>
            <div class="driveinfolist tc">
                <table class="tb_list f14">
                    <tr class="tr_head tf">
                        <th class="wp2">
                        </th>
                        <th class="wp10 tc bdl">
                            姓名
                        </th>
                        <th class="wp8 tc bdl">
                            性别
                        </th>
                        <th class="wp10 tc bdl">
                            职位
                        </th>
                        <th class="wp15 tc bdl">
                            联系方式
                        </th>
                        <th class="wp16 tc bdl">
                            电子邮箱
                        </th>
                        <th class="wp16 tc bdl">
                            备注
                        </th>
                        <th class="wp20 tc bdl">
                            操作
                        </th>
                        <th class="wp2 bdl">
                        </th>
                    </tr>
                    @foreach (var item in Model)
                    {
                        <tr>
                            <td>
                            </td>
                            <td>
                                @item.Name
                            </td>
                            <td>
                                @item.Sex
                            </td>
                            <td>
                                @item.Position
                            </td>
                            <td>
                                @item.Telephone
                            </td>
                            <td>
                                @item.Email
                            </td>
                            <td>
                                <div class="setremark">@item.Remark</div>
                            </td>
                            <td>
                                @Html.ActionLink("编辑", "Edit", new { id = item.ApplicantID }) |
                                @Html.ActionLink("详情", "Details", new { id = item.ApplicantID }) |
                                @*@Html.ActionLink("删除", "Delete", new { id = item.ApplicantID })*@
                                <a href="javascript:void(0)" onclick="DeleteApplicant(@item.ApplicantID)">删除</a>
                            </td>
                            <td>
                            </td>
                        </tr>
                    }
                </table>
            </div>
            <div class="pagewrap">
                共<span id="TotalItems" class="allitems numstyle"></span>条记录， 每页显示<span id="ItemsPerPage"
                    class="itemsperpage numstyle"></span>条， 共<span id="TotalPages" class="allpages numstyle"></span>页，
                当前第<span id="CurrentPage" class="curpage numstyle"></span>页 <a id="FirstPage" class="fir_page"
                    href="javascript:void(0)">首页</a> <a id="PrevPage" class="pre_page" href="javascript:void(0)">
                        上一页</a> <a id="NextPage" class="next_page" href="javascript:void(0)">下一页</a>
                <a id="LastPage" class="last_page" href="javascript:void(0)">末页</a> <span>跳转到</span>
                <input type="text" class="input_page" id="PageToGo" />
                <input type="button" class="btn_gotopage" id="GoToPage" value="Go" />
            </div>
        </div>
    </div>
    @Html.Partial("_PartviewApplicantLeftbar")
    <div class="content_contract fl">
        <a href="javascript:void(0)" class="btn_contract w8h32" id="contract" title="收缩">
        </a><a href="javascript:void(0)" class="btn_expand w8h32" id="expand" title="展开">
        </a>
    </div>
    <div class="cb">
    </div>
</div>
<script type="text/javascript" src="../../Scripts/jquery-1.5.1.js"></script>
<script src="@Url.Content("~/Scripts/jquery.query-2.1.7.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/SetPagingScript.js")" type="text/javascript"></script>
<script type="text/javascript">
    function DeleteApplicant(id) {
        if (confirm("您确认删除这个申请人吗?")) {
            $.post("/Applicant/Delete", "id=" + id, function (ret) {
                if (ret.Result == "true") {
                    alert(ret.Message);
                    window.location.reload();
                }
                else {
                    alert(ret.Message);
                }
            }, "json");
        }
    }
    $(document).ready(function () {
        $("#driver_cx_content").toggle();
        $("tr:even").css("background-color", "#D7DBE4");

        if ($.query.get("Page") != "") {
            $("#Page").val($.query.get("Page"));
        }
        else {
            $("#Page").val(1);
        }

        if ($.query.get("Name").toString() != "true") {
            $("input[name='Name']").val($.query.get("Name"));
        }

        if ($.query.get("Position").toString() != "true") {
            $("select[name='Position']").val($.query.get("Position"));
        }

        if ($.query.get("Sex").toString() != "true") {
            $("select[name='Sex']").val($.query.get("Sex"));
        }

        $.get("/Applicant/GetPagingInfo",
            {
                Name: $("input[name='Name']").val(),
                Position: $("select[name='Position']").val(),
                Sex: $("select[name='Sex']").val(),
                Page: $("#Page").val()
            },
            function (data) {
                $("#TotalItems").text(data.TotalItems);
                $("#ItemsPerPage").text(data.ItemsPerPage);
                $("#TotalPages").text(data.TotalPages);
                $("#CurrentPage").text($("#Page").val());
            }
        );
        SetPagingOperation();
    });
 
</script>
